package cn.iocoder.yudao.module.erp.dal.mysql.exchange;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.exchange.vo.order.ErpExchangeOrderPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.exchange.ErpExchangeOrderDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * ERP 旧料兑换订单 Mapper
 */
@Mapper
public interface ErpExchangeOrderMapper extends BaseMapperX<ErpExchangeOrderDO> {

    default PageResult<ErpExchangeOrderDO> selectPage(ErpExchangeOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpExchangeOrderDO>()
                .likeIfPresent(ErpExchangeOrderDO::getNo, reqVO.getNo())
                .eqIfPresent(ErpExchangeOrderDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(ErpExchangeOrderDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ErpExchangeOrderDO::getExchangeTime, reqVO.getExchangeTime())
                .betweenIfPresent(ErpExchangeOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ErpExchangeOrderDO::getId));
    }

} 